package com.wang;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class ComplexTest {
    public static void main(String[] args) {
        List<Complex> list = new ArrayList<>();
        Random random = new Random();
        //集合里添加50个对象
        for(int i = 0 ; i < 50 ; i++) {
            list.add(new Complex(random.nextInt(1000), random.nextInt(1000)));
        }
        show(list, c->c.check());
    }
    public boolean check(Complex c) {
        return c.imag > 200 && c.real > 400;
    }
    public static void show(List<Complex> lists , ComplexChecker checker){
        for (Complex com: lists) {
            if(checker.check(com))
                System.out.println(com);
        }
    }
}